<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>uuencode</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_001_014_2657">&nbsp;</a>NAME</h4><blockquote>
uuencode - encode a binary file
</blockquote><h4><a name = "tag_001_014_2658">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

uuencode <b>[</b><i>file</i><b>]</b><i> decode_pathname
</i></code>
</pre>
</blockquote><h4><a name = "tag_001_014_2659">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>uuencode</i>
utility writes an encoded version of
the named input file, or standard input if no
<i>file</i>
is specified,
to standard output.
The output is encoded using
the algorithm described in the STDOUT section and includes the
file access permission bits (in
<i><a href="chmod.html">chmod</a></i>
octal or symbolic notation)
of the input file and the
<i>decode_pathname</i>,
for re-creation of the file on another
system that conforms to this specification.
</blockquote><h4><a name = "tag_001_014_2660">&nbsp;</a>OPTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_2661">&nbsp;</a>OPERANDS</h4><blockquote>
The following operands are supported:
<dl compact>

<dt><i>decode_pathname</i><dd>
The pathname of the file into which the
<i><a href="uudecode.html">uudecode</a></i>
utility
will place the decoded file.
If there are characters in
<i>decode_pathname</i>
that are not in the
portable filename character set
the results are unspecified.

<dt><i>file</i><dd>A pathname of the file to be encoded.

</dl>
</blockquote><h4><a name = "tag_001_014_2662">&nbsp;</a>STDIN</h4><blockquote>
See the INPUT FILES section.
</blockquote><h4><a name = "tag_001_014_2663">&nbsp;</a>INPUT FILES</h4><blockquote>
Input files can be files of any type.
</blockquote><h4><a name = "tag_001_014_2664">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>
The following environment variables affect the execution of
<i>uuencode</i>:
<dl compact>

<dt><i>LANG</i><dd>Provide a default value for the internationalisation variables
that are unset or null.
If
<i>LANG</i>
is unset or null, the corresponding value from the
implementation-dependent default locale will be used.
If any of the internationalisation variables contains an invalid setting, the
utility will behave as if none of the variables had been defined.

<dt><i>LC_ALL</i><dd>
If set to a non-empty string value,
override the values of all the other internationalisation variables.

<dt><i>LC_CTYPE</i><dd>
Determine the
locale for the interpretation of sequences of bytes of text data as
characters (for example, single- as opposed to multi-byte characters
in arguments and input files).

<dt><i>LC_MESSAGES</i><dd>
Determine the locale that should be used to affect
the format and contents of diagnostic
messages written to standard error.

<dt><i>NLSPATH</i><dd>
Determine the location of message catalogues
for the processing of
<i>LC_MESSAGES .
</i>
</dl>
</blockquote><h4><a name = "tag_001_014_2665">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_001_014_2666">&nbsp;</a>STDOUT</h4><blockquote>
The standard output is a text file (encoded in the
character set of the current locale)
that begins with the line:
<p><code>
<tt>"begin<img src="../images/delta.gif" border=0>%s<img src="../images/delta.gif" border=0>%s\n"</tt>, &lt;<i>mode</i>&gt;,
<i>decode_pathname</i>
</code>
and ends with the line:
<p><code>
end\n
</code>
<p>
In both cases, the lines have no preceding or trailing
blank characters.
<p>
The algorithm that is used for lines in between
<b>begin</b>
and
<b>end</b>
takes three octets as input
and writes four characters of output by splitting the input at six-bit
intervals into four octets, containing data in the lower six bits only.
These octets are converted to characters by adding
a value of 0x20
to each octet, so that each octet
is in the range 0x20-0x5f, and then
it is assumed to
represent a printable character in the ISO/IEC&nbsp;646:1991 standard
encoded character set.
It then will be translated into the corresponding
character codes for the codeset in use in the current locale.
(For example, the octet 0x41, representing
A,
would be translated to
A
in the current codeset, such as 0xc1 if it were EBCDIC.)
<p>
Where the bits of two octets are combined, the least significant bits of
the first octet are shifted left and combined with the most significant
bits of the second octet shifted right.
Thus the three octets A, B, C are converted into the four octets:
<pre>
<code>
0x20 + (( A &gt;&gt; 2                    ) &amp; 0x3F)
0x20 + (((A &lt;&lt; 4) ' |' ((B &gt;&gt; 4) &amp; 0xF)) &amp; 0x3F)
0x20 + (((B &lt;&lt; 2) ' |' ((C &gt;&gt; 6) &amp; 0x3)) &amp; 0x3F)
0x20 + (( C                         ) &amp; 0x3F)
</code>
</pre>
These octets are then translated into the local character set.
<p>
Each encoded line contains a length character, equal to the number
of characters to be decoded plus 0x20 translated to the local
character set as described above, followed by the encoded
characters.
The maximum number of octets to be encoded on each line is 45.
</blockquote><h4><a name = "tag_001_014_2667">&nbsp;</a>STDERR</h4><blockquote>
Used only for diagnostic messages.
</blockquote><h4><a name = "tag_001_014_2668">&nbsp;</a>OUTPUT FILES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_2669">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_2670">&nbsp;</a>EXIT STATUS</h4><blockquote>
The following exit values are returned:
<dl compact>

<dt>0<dd>Successful completion.

<dt>&gt;0<dd>An error occurred.

</dl>
</blockquote><h4><a name = "tag_001_014_2671">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_001_014_2672">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
The file is expanded by 35 percent
(each three octets become four, plus control information)
causing it to take longer to transmit.
<p>
Since this utility is intended to create files to
be used for data interchange between systems with possibly
different codesets,
and to represent binary data as a text file,
the ISO/IEC&nbsp;646:1991 standard
was chosen for a midpoint in the algorithm as a known reference point.
The output from
<i>uuencode</i>
is a text file on the local system.
If the output were in the ISO/IEC&nbsp;646:1991 standard
codeset, it might not be a text file (at least because the
newline characters
might not match), and the goal of creating a text file
would be defeated.
If this text file was then carried to another machine
with the same codeset, it would be perfectly compatible
with that system's
<i><a href="uudecode.html">uudecode</a></i>.
If it was transmitted over a mail system
or sent to a machine with a different codeset,
it is assumed that, as for every other text file, some translation mechanism
would convert it (by the time it reached a user on the other system) into an
appropriate codeset.
This translation only makes sense from the local
codeset, not if the file has been put into a ISO/IEC&nbsp;646:1991 standard
representation first.
Similarly, files processed by
<i>uuencode</i>
can be placed in
<i><a href="pax.html">pax</a></i>
archives, intermixed with other text files in the same codeset.
<p>
The algorithm is described in terms of 8-bit quantities, or octets.
Since no byte alignment is implied, it will encode data from machines
with any number of bits per byte.
However, unless that encoded data is then decoded on a
machine with the same number of bits per byte,
the output might not be useful.
</blockquote><h4><a name = "tag_001_014_2673">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_2674">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_2675">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="mailx.html">mailx</a></i>,
<i><a href="uudecode.html">uudecode</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
